package com.dc.controller;

import com.dc.base.aop.AopOperation;
import com.dc.base.baseController.BaseController;
import com.dc.base.em.RoleMenuEnum;
import com.dc.base.vo.BaseModel;
import com.dc.model.User;
import com.dc.service.MenuService;
import com.wordnik.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("menu")
public class MenuController extends BaseController {
    @Autowired
    MenuService menuService;

//    @AopOperation(desc = "查询我的菜单",type = "查询",menu = RoleMenuEnum.NO_203)
    @ApiOperation(value="查询登录用户的权限",httpMethod = "GET",notes="查询")
    @RequestMapping(value="/selectMyMenu", method = RequestMethod.GET)
    @ResponseBody
    public BaseModel selectMyMenu(HttpServletRequest request,BaseModel baseModel)
    throws Exception {
        HttpSession session =request.getSession();
        System.out.println(session);
        User user=(User)session.getAttribute("currentUser");
        System.out.println(user);
        System.out.println(user.getUser_id());
        return  menuService.selectMyMenu(user.getUser_id(),baseModel);

    }
}
